package com.micro.ai.commons.constant;

/**
 * 缓存键常量
 * 
 * @author micro-ai
 * @since 0.0.1
 */
public interface CacheKeyConstants {

    /**
     * 缓存键前缀
     */
    String CACHE_PREFIX = "micro-ai:";
    
    /**
     * 用户相关缓存键
     */
    interface User {
        String USER_INFO = CACHE_PREFIX + "user:info:";
        String USER_PERMISSIONS = CACHE_PREFIX + "user:permissions:";
        String USER_ROLES = CACHE_PREFIX + "user:roles:";
        String USER_SESSION = CACHE_PREFIX + "user:session:";
        
        /**
         * 获取用户信息缓存键
         */
        static String getUserInfoKey(Long userId) {
            return USER_INFO + userId;
        }
        
        /**
         * 获取用户权限缓存键
         */
        static String getUserPermissionsKey(Long userId) {
            return USER_PERMISSIONS + userId;
        }
        
        /**
         * 获取用户角色缓存键
         */
        static String getUserRolesKey(Long userId) {
            return USER_ROLES + userId;
        }
        
        /**
         * 获取用户会话缓存键
         */
        static String getUserSessionKey(String sessionId) {
            return USER_SESSION + sessionId;
        }
    }
    
    /**
     * Agent相关缓存键
     */
    interface Agent {
        String AGENT_INFO = CACHE_PREFIX + "agent:info:";
        String AGENT_STATUS = CACHE_PREFIX + "agent:status:";
        String AGENT_MODEL = CACHE_PREFIX + "agent:model:";
        String AGENT_TEMPLATE = CACHE_PREFIX + "agent:template:";
        
        /**
         * 获取Agent信息缓存键
         */
        static String getAgentInfoKey(Long agentId) {
            return AGENT_INFO + agentId;
        }
        
        /**
         * 获取Agent状态缓存键
         */
        static String getAgentStatusKey(Long agentId) {
            return AGENT_STATUS + agentId;
        }
        
        /**
         * 获取Agent模型缓存键
         */
        static String getAgentModelKey(Long agentId) {
            return AGENT_MODEL + agentId;
        }
        
        /**
         * 获取Agent模板缓存键
         */
        static String getAgentTemplateKey(Long agentId) {
            return AGENT_TEMPLATE + agentId;
        }
    }
    
    /**
     * 模板相关缓存键
     */
    interface Template {
        String TEMPLATE_INFO = CACHE_PREFIX + "template:info:";
        String TEMPLATE_CONTENT = CACHE_PREFIX + "template:content:";
        String TEMPLATE_CATEGORY = CACHE_PREFIX + "template:category:";
        
        /**
         * 获取模板信息缓存键
         */
        static String getTemplateInfoKey(Long templateId) {
            return TEMPLATE_INFO + templateId;
        }
        
        /**
         * 获取模板内容缓存键
         */
        static String getTemplateContentKey(Long templateId) {
            return TEMPLATE_CONTENT + templateId;
        }
        
        /**
         * 获取模板分类缓存键
         */
        static String getTemplateCategoryKey(Long categoryId) {
            return TEMPLATE_CATEGORY + categoryId;
        }
    }
    
    /**
     * 工作流相关缓存键
     */
    interface Workflow {
        String WORKFLOW_INFO = CACHE_PREFIX + "workflow:info:";
        String WORKFLOW_STATUS = CACHE_PREFIX + "workflow:status:";
        String WORKFLOW_EXECUTION = CACHE_PREFIX + "workflow:execution:";
        
        /**
         * 获取工作流信息缓存键
         */
        static String getWorkflowInfoKey(Long workflowId) {
            return WORKFLOW_INFO + workflowId;
        }
        
        /**
         * 获取工作流状态缓存键
         */
        static String getWorkflowStatusKey(Long workflowId) {
            return WORKFLOW_STATUS + workflowId;
        }
        
        /**
         * 获取工作流执行缓存键
         */
        static String getWorkflowExecutionKey(Long executionId) {
            return WORKFLOW_EXECUTION + executionId;
        }
    }
    
    /**
     * 训练相关缓存键
     */
    interface Training {
        String TRAINING_TASK = CACHE_PREFIX + "training:task:";
        String TRAINING_MODEL = CACHE_PREFIX + "training:model:";
        String TRAINING_DATASET = CACHE_PREFIX + "training:dataset:";
        
        /**
         * 获取训练任务缓存键
         */
        static String getTrainingTaskKey(Long taskId) {
            return TRAINING_TASK + taskId;
        }
        
        /**
         * 获取训练模型缓存键
         */
        static String getTrainingModelKey(Long modelId) {
            return TRAINING_MODEL + modelId;
        }
        
        /**
         * 获取训练数据集缓存键
         */
        static String getTrainingDatasetKey(Long datasetId) {
            return TRAINING_DATASET + datasetId;
        }
    }
    
    /**
     * 系统相关缓存键
     */
    interface System {
        String SYSTEM_CONFIG = CACHE_PREFIX + "system:config:";
        String SYSTEM_DICT = CACHE_PREFIX + "system:dict:";
        String SYSTEM_MENU = CACHE_PREFIX + "system:menu:";
        String SYSTEM_PERMISSION = CACHE_PREFIX + "system:permission:";
        
        /**
         * 获取系统配置缓存键
         */
        static String getSystemConfigKey(String configKey) {
            return SYSTEM_CONFIG + configKey;
        }
        
        /**
         * 获取系统字典缓存键
         */
        static String getSystemDictKey(String dictType) {
            return SYSTEM_DICT + dictType;
        }
        
        /**
         * 获取系统菜单缓存键
         */
        static String getSystemMenuKey(Long menuId) {
            return SYSTEM_MENU + menuId;
        }
        
        /**
         * 获取系统权限缓存键
         */
        static String getSystemPermissionKey(Long permissionId) {
            return SYSTEM_PERMISSION + permissionId;
        }
    }
}
